package com.yby.mall.storage.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.pagehelper.PageHelper;
import com.yby.common.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yby.common.utils.PageUtils;
import com.yby.common.utils.Query;

import com.yby.mall.storage.dao.WareInfoDao;
import com.yby.mall.storage.entity.WareInfoEntity;
import com.yby.mall.storage.service.WareInfoService;
import org.springframework.util.StringUtils;


@Service("wareInfoService")
public class WareInfoServiceImpl extends ServiceImpl<WareInfoDao, WareInfoEntity> implements WareInfoService {

    @Autowired
    private WareInfoDao wareInfoDao;


    @Override
    public R queryPage(Integer page, Integer limit, String key) {
        PageHelper.startPage(page,limit);
        List<WareInfoEntity> list = wareInfoDao.selectList(Wrappers.<WareInfoEntity>lambdaQuery()
                .like(!StringUtils.isEmpty(key), WareInfoEntity::getName, key));
        return R.ok().put("page", PageUtils.restPage(list));
    }
}